import { Controller, Post, Get, Body } from '@nestjs/common';
import { GroupsService } from './groups.service';
import { WebCamsService } from './web-cams.service';

@Controller('/web-cam')
export class WebCamsController {
	constructor(private groupsService: GroupsService, private camsService: WebCamsService) {}
	
	@Post('/insertGroup')
	async insertGroup(@Body() data: any) {
	  return this.groupsService.insertMany([data])
	}
	
	@Get('/findGroups')
	async findGroups() {
	  return this.groupsService.find()
	}
	
	@Post('/updateGroup')
	async updateGroup(@Body() data: any) {
	  return this.groupsService.updateOne(data)
	}
	
	@Post('/deleteGroup')
	async deleteGroup(@Body() data: any) {
	  return this.groupsService.deleteOne(data)
	}
	
	@Post('/insertCam')
	async insertCam(@Body() data: any) {
	  return this.camsService.insertMany([data])
	}
	
	@Get('/findCams')
	async findCams() {
		return this.camsService.find()
	}
	
	@Post('/updateCam')
	async updateCam(@Body() data: any) {
	  return this.camsService.updateOne(data)
	}
	
	@Post('/deleteCam')
	async deleteCam(@Body() data: any) {
	  return this.camsService.deleteOne(data)
	}
}
